home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / CONTRSRC.ZIP / SRC / BISMARCK / STARWAR / STARWAR2.ASM < prev    next >
Encoding:
Assembly Source File  |  1994-11-20  |  20.5 KB  |  873 lines

  1. ;************************************************
  2. ;* StarWars Scroller by Bismarck / TFL-TDV 1994 *
  3. ;************************************************
  4.     INCLUDE  PDFIK.INC
  5.     INCLUDE  VIDEO.INC
  6.     INCLUDE  PLAYINFO.INC
  7.  
  8. ;--------------------------------------------------------------------------
  9. ;                          Structure mémoire ...
  10. ;--------------------------------------------------------------------------
  11. .386
  12.     DGROUP  GROUP _DATA,_BSS
  13.     STAR_TEXT SEGMENT DWORD PUBLIC USE16 'CODE'
  14.         ASSUME CS:STAR_TEXT, DS:STAR_DATA;,FS:DGROUP
  15.     STAR_TEXT ENDS
  16.     _DATA   SEGMENT DWORD PUBLIC USE16 'DATA'
  17.     _DATA   ENDS
  18.     _BSS    SEGMENT DWORD PUBLIC USE16 'BSS'
  19.     _BSS    ENDS
  20.     STAR_DATA SEGMENT DWORD PUBLIC USE16 'FAR_DATA'
  21.     STAR_DATA ENDS
  22.  
  23. ;--------------------------------------------------------------------------
  24.  
  25.   Larg=320
  26.   Haut=200
  27.   Screen1 = 0
  28.   Screen2 = (Larg*Haut/4)
  29.   Screen3 = (Larg*Haut*2/4)
  30.  
  31.  
  32. _DATA SEGMENT
  33.  
  34. ;-- donnees pattern --
  35. EXTRN _Datafile  : BYTE
  36. EXTRN _OfsinDta  : DWORD
  37.  
  38. Picname1   BYTE 'source.cal',0  ; nom pic ...
  39. Picparam1  PARAM_STRUC<2,DGROUP,OFFSET _Datafile,OFFSET Picname1,0,0,0,,,0>
  40. Picname2   BYTE 'dest.cal',0  ; nom pic ...
  41. Picparam2  PARAM_STRUC<2,DGROUP,OFFSET _Datafile,OFFSET Picname2,0,0,0,,,0>
  42. Picname3   BYTE 'shade.cal',0  ; nom pic ...
  43. Picparam3  PARAM_STRUC<2,DGROUP,OFFSET _Datafile,OFFSET Picname3,0,0,0,,,0>
  44. Picname4   BYTE 'font.tdv',0  ; nom pic ...
  45. Picparam4  PARAM_STRUC<2,DGROUP,OFFSET _Datafile,OFFSET Picname4,0,0,0,,,0>
  46.  
  47. _DATA ENDS
  48.  
  49. ;--------------------------------------------------------------------------
  50.  
  51. _BSS SEGMENT
  52.  
  53.     EXTRN _FrameCounter     : WORD
  54.     EXTRN _ExitDemo         : WORD
  55.         EXTRN _SpaceBar         : WORD
  56.         EXTRN _FadeON           : WORD
  57.     EXTRN _CPUtime          : WORD
  58.     EXTRN _StartAdr         : WORD
  59.     EXTRN _WorkAdr          : WORD
  60.     EXTRN _NextAdr          : WORD
  61.     EXTRN _Triple           : WORD
  62.     EXTRN _SyncFlag         : WORD
  63.     EXTRN _MichFlag         : WORD
  64.  
  65.         ;!!!!!!!!!! sync music !!!!!!!!!!
  66.         EXTRN _MP               : DWORD ; extern ModulePlayer * MB
  67.         EXTRN _ReplayInfo       : mpInformation
  68.  
  69.  
  70. _BSS ENDS
  71.  
  72. ;--------------------------------------------------------------------------
  73.   red EQU 0
  74.   green EQU 1
  75.   blue EQU 2
  76. ;--------------------------------------------------------------------------
  77. STAR_DATA SEGMENT
  78.    ; variables à utiliser !
  79.   filename1 byte "FONT.TDV",00h
  80.   filename2 byte "SOURCE.CAL",00h
  81.   filename3 byte "DEST.CAL",00h
  82.   filename4 byte "SHADE.CAL",00h
  83.  
  84. cumul_step_lo DD 0
  85. cumul_step_hi DD 0
  86. cumul_old_lo  DD 0
  87. cumul_old_hi  DD 0
  88.  
  89. ;---- param pour synchro avec zizik ----
  90. EVEN
  91. DebSong  WORD ?
  92. FinSong  WORD ?
  93.  
  94.  
  95.   baseadress word 0
  96.   Desti word 0
  97.   curstep word 3
  98.   handle word ?
  99.   font1 word ?
  100.   buf word ?
  101.   buf2 word ?
  102.   source word ?
  103.   dest word ?
  104.   shade word ?
  105.   ds2 word ?
  106.   y word 0
  107.   tailley word ?
  108.   tailleyd2 word ?
  109.   bp2 word ?
  110.   var word ?
  111.   INCLUDE datafile.inc
  112.   INCLUDE textefin.inc
  113. STAR_DATA ENDS
  114.  
  115. ;*****************************************************************************
  116. STAR_TEXT SEGMENT
  117.            PUBLIC _StartStar
  118.            EXTERN _SetVGA   : FAR
  119.            EXTERN _WaitVBL  : FAR
  120.  
  121.  
  122. MPUSH   MACRO reg1:REQ,reg2:VARARG   ; Vive Y.Roggeman/Greg & ses Macros
  123.         push reg1                    ; recursives !!!!!!! yahouuuuu !!!
  124.         IFNB <reg2>
  125.         MPUSH reg2
  126.         ENDIF
  127.         ENDM
  128.  
  129. MPOP    MACRO reg1:REQ,reg2:VARARG   ; bis bis !!!
  130.         IFNB <reg2>                  ; type brol = record....
  131.         MPOP reg2                    ; donc ça fait 20 bytes !!!
  132.         ENDIF                        ; donc 1 word ....
  133.         pop reg1                     ; brol je dis struct !!!
  134.         ENDM
  135.  
  136.  
  137. FLUSH_KEYBUF MACRO
  138.         MPUSH   ax,es
  139.  
  140.         mov     ax,40h                ; Flush keyboard buffer !!! ;-)
  141.         mov     es,ax
  142.         mov     ax,es:[001ah]
  143.         mov     es:[001ch],ax  
  144.  
  145.         MPOP    ax,es
  146.         ENDM
  147.  
  148.  
  149. NEXTSTEP MACRO
  150.         LOCAL lbl1
  151.  
  152. ;------------ FrameCounter manip ------------
  153.         MPUSH  eax,ebx,ecx,edx
  154.  
  155.         mov    cx,fs:_FrameCounter
  156.         test   cx,cx
  157.         jnz    lbl1
  158.         mov    cx,1
  159.  
  160. lbl1:   xor    eax,eax
  161. ;        mov    ah,cl ; frame*256
  162.      ;   mov    ax,384 ;307              ; 1.5*256 = factor
  163.      ;   mul    cx
  164.         mov    ax,128
  165.         mul    cx
  166.  
  167.         mov    ecx,cumul_step_lo   ; save old cumulated step (64 bits)
  168.         mov    cumul_old_lo,ecx
  169.         mov    ecx,cumul_step_hi
  170.         mov    cumul_old_hi,ecx   
  171.      
  172.         add    cumul_step_lo,eax   ; multiprecision
  173.         adc    cumul_step_hi,0
  174.  
  175.         mov    ecx,cumul_step_hi
  176.         mov    eax,cumul_step_lo
  177.         shrd   eax,ecx,8           ; / 256
  178.         mov    edx,cumul_old_hi
  179.         mov    ebx,cumul_old_lo
  180.         shrd   ebx,edx,8
  181.  
  182.         sub    eax,ebx
  183. ;        sbb    ecx,edx
  184.  
  185.         mov    CurStep,ax  ; CurStep = factor * FrameCounter
  186.  
  187.         mov    fs:_FrameCounter,0
  188.  
  189.         MPOP   eax,ebx,ecx,edx
  190. ;--------------------------------------------
  191.  
  192. ENDM
  193.  
  194. COLOR MACRO col:REQ
  195.  
  196.       MPUSH ax,dx
  197.       mov dx,3c8h
  198.       xor al,al
  199.       out dx,al
  200.       mov al,col
  201.       inc dl
  202.       out dx,al
  203.       out dx,al
  204.       out dx,al
  205.       MPOP ax,dx
  206.  
  207. ENDM
  208.  
  209. SHOWTIME MACRO col:REQ
  210.         LOCAL lbl1
  211.         test            fs:_CPUtime,1
  212.         jz              lbl1
  213.         COLOR           col
  214. lbl1:
  215.  
  216. ENDM
  217.  
  218. LOOPUNTILKEY MACRO lbl
  219.          LOCAL   lbl1,lbl2,lbl3
  220.  
  221.          in      al,60h              ; EXIT ?
  222.          cmp     al,78               ; '+'
  223.          jne     lbl1
  224.          mov     fs:_CPUtime,1       ; set CPUtime Flag to ON ....
  225.          jmp     lbl
  226. lbl1:    cmp     al,74               ; '-'
  227.          jne     lbl2
  228.          mov     fs:_CPUtime,0       ; set CPUtime Flag to OFF ....
  229.          jmp     lbl
  230. lbl2:    cmp     al,39h              ; Space Bar ...
  231.          jne     lbl3
  232.          mov     fs:_SpaceBar,1
  233.          jmp     fin
  234.  
  235. lbl3:
  236.          cmp     al,1                ; Escapff...
  237.          jne     lbl
  238.          mov     fs:_ExitDemo,1      ; exit the whole demo !!!!
  239.          jmp     fin
  240.  
  241. ENDM
  242.  
  243.  
  244. ;*****************************************************************************
  245. Load_stretchpdfik MACRO
  246.     mov     eax,fs:_OfsinDta      ; OFFSET in Datafile
  247.     mov     fs:Picparam1.OfsInPdf,eax
  248.     mov     ax,DGROUP             ; prepare for PDFIK call
  249.     mov     es,ax
  250.     mov     bx,OFFSET Picparam1
  251.     pusha
  252.     call    PDFIK_ASM             ; call function 2 (extract+alloc)
  253.     popa
  254.     mov     ax,fs:Picparam1.BufSeg ; where is the file in mem ?
  255.     mov     source,ax
  256.  
  257.     mov     eax,fs:_OfsinDta      ; OFFSET in Datafile
  258.     mov     fs:Picparam2.OfsInPdf,eax
  259.     mov     ax,DGROUP             ; prepare for PDFIK call
  260.     mov     es,ax
  261.     mov     bx,OFFSET Picparam2
  262.     pusha
  263.     call    PDFIK_ASM             ; call function 2 (extract+alloc)
  264.     popa
  265.     mov     ax,fs:Picparam2.BufSeg ; where is the file in mem ?
  266.     mov     dest,ax
  267.  
  268.     mov     eax,fs:_OfsinDta      ; OFFSET in Datafile
  269.     mov     fs:Picparam3.OfsInPdf,eax
  270.     mov     ax,DGROUP             ; prepare for PDFIK call
  271.     mov     es,ax
  272.     mov     bx,OFFSET Picparam3
  273.     pusha
  274.     call    PDFIK_ASM             ; call function 2 (extract+alloc)
  275.     popa
  276.     mov     ax,fs:Picparam3.BufSeg ; where is the file in mem ?
  277.     mov     shade,ax
  278. ENDM
  279.  
  280. WAITVRT MACRO
  281.        call _WaitVBL
  282. ENDM
  283.  
  284. NEW MACRO nom, mem
  285.   LOCAL suite, erreur2, fin, plusbas
  286.   ; déclare et alloue mem byte à un pointeur
  287.  
  288.      mov        ah, 48h
  289.      mov        bx, mem
  290.      shr        bx, 4
  291.      inc        bx
  292.      int        21h
  293.      jnc        plusbas
  294.      changezero 63
  295. plusbas:
  296.      mov        nom, ax
  297. fin:
  298. ENDM
  299. ;--------------------------------------------------------------------------
  300.   FREE MACRO nom
  301.   ; Libère la mémoire pointée par nom
  302.      mov        ax, nom
  303.      mov        es, ax
  304.      mov        ah, 49h
  305.      int        21h
  306.   ENDM
  307.  
  308. ;----------------------------------------------------------------------
  309. Reset_Cursor MACRO
  310.     mov     ah, 01h
  311.     mov     cx, 0506h
  312.     int     10h
  313. ENDM
  314. ;----------------------------------------------------------------------
  315. No_Cursor MACRO
  316.     mov     ah, 01h
  317.     mov     cx, 0FF00h
  318.     int     10h
  319. ENDM
  320.  
  321. ;----------------------------------------------------------------------
  322. LOAD_PAL MACRO PAL
  323. local bcl
  324.     mov     dx, 3C8h
  325.     mov     ax, 0
  326.     xor     si, si
  327. bcl:    out     dx, al
  328.     inc     dx
  329.     push    ax
  330.     mov     al, byte ptr &PAL&[si]
  331.     out     dx, al
  332.     mov     al, byte ptr &PAL&[si+1]
  333.     out     dx, al
  334.     mov     al, byte ptr &PAL&[si+2]
  335.     out     dx, al
  336.     pop     ax
  337.     dec     dx
  338.     add     si, 3
  339.     inc     ax
  340.     cmp     ax, 256
  341.     jl      bcl
  342. ENDM
  343.  
  344.  
  345. ;----------------------------------------------------------------------
  346. LOAD_PAL MACRO PAL
  347. local bcl
  348.     mov     dx, 3C8h
  349.     mov     ax, 0
  350.     xor     si, si
  351. bcl:    out     dx, al
  352.     inc     dx
  353.     push    ax
  354.     mov     al, byte ptr &PAL&[si]
  355.     out     dx, al
  356.     mov     al, byte ptr &PAL&[si+1]
  357.     out     dx, al
  358.     mov     al, byte ptr &PAL&[si+2]
  359.     out     dx, al
  360.     pop     ax
  361.     dec     dx
  362.     add     si, 3
  363.     inc     ax
  364.     cmp     ax, 256
  365.     jl      bcl
  366. ENDM
  367.  
  368. Init13h MACRO
  369.     mov ax,13h
  370.     int 10h
  371. ENDM
  372. ;----------------------------------------------------------------------
  373. LOAD_FONT MACRO
  374.       push          ds
  375.       mov           dx, offset filename1
  376.       mov           ax, 3D00h
  377.       mov           cx, 0
  378.       int           21h
  379.       mov           handle, ax
  380.  
  381.       mov           ax, 3F00h
  382.       mov           bx, handle
  383.       mov           cx, 22260
  384.       mov           dx, font1
  385.       mov           ds, dx
  386.       mov           dx, 0
  387.       int           21h
  388.       pop           ds
  389.  
  390.       mov           ax, 3E00h
  391.       mov           bx, handle
  392.       int           21h
  393. ENDM
  394. ;----------------------------------------------------------------------
  395. LOAD_FONTPDFIK MACRO
  396.     mov     eax,fs:_OfsinDta      ; OFFSET in Datafile
  397.     mov     fs:Picparam4.OfsInPdf,eax
  398.     mov     ax,DGROUP             ; prepare for PDFIK call
  399.     mov     es,ax
  400.     mov     bx,OFFSET Picparam4
  401.     pusha
  402.     call    PDFIK_ASM             ; call function 2 (extract+alloc)
  403.     popa
  404.     mov     ax,fs:Picparam4.BufSeg ; where is the file in mem ?
  405.     mov     font1,ax
  406.  
  407. ENDM
  408.  
  409. changezero MACRO col
  410.         mov     al, 0
  411.         mov     dx, 3c8h                ;{ DAC set write mode }
  412.                         ; mov     al, index
  413.         out     dx, al                  ;{ set to write mode }
  414.         mov     dx, 3c9h                ;{ address of DAC read data }
  415.         mov     al, col                 ;
  416.         out     dx, al                  ;{ set new red value }
  417.         mov     al, 0                   ;
  418.         out     dx, al                  ;{ set new green value }
  419.         mov     al, 0                  ;
  420.         out     dx, al                  ;{ set new blue value }
  421. ENDM ;{DACRemapColour}
  422.  
  423. VGApalette MACRO
  424. ; INPUT al : index
  425. ;       ah : red
  426. ;       bh : green
  427. ;       bl : blue
  428.  
  429. ;{ N.B. no wait for vertical retrace is done }
  430.         mov     dx, 3c8h                ;{ DAC set write mode }
  431.                         ; mov     al, index
  432.         out     dx, al                  ;{ set to write mode }
  433.         mov     dx, 3c9h                ;{ address of DAC read data }
  434.         mov     al, ah                  ;
  435.         out     dx, al                  ;{ set new red value }
  436.         mov     al, bh                   ;
  437.         out     dx, al                  ;{ set new green value }
  438.         mov     al, bl                  ;
  439.         out     dx, al                  ;{ set new blue value }
  440. ENDM ;{DACRemapColour}
  441.  
  442. BUILD_PALETTE MACRO
  443. LOCAL Loopal,endloopal,loop
  444. ;  for i:=0 to 11 do vgapalette(i,63-img^.palette[i,red],0,0);
  445.         mov       cx,0
  446.         mov       ax,_data
  447.         mov       ds,ax
  448.         mov       ax,0
  449.         mov       bx,0
  450.         xor       ax,ax
  451. loop:           push      ax
  452. loopal:         mov       bl,cl
  453.         mov       al,cl
  454.         inc       al
  455.         mov       dl,byte ptr palette[bx]
  456.         mov       ah,63
  457.         sub       ah,dl
  458.         mov       bl,1
  459.         vgapalette
  460.         inc       cl
  461.         cmp       cl,13
  462. endloopal:      jne       loopal
  463.         pop       ax
  464.         inc       ax
  465.         cmp       ax,10
  466.         jne       loop
  467. ENDM
  468.  
  469. Copy_font MACRO ligne
  470.   local loopy,loopx,loopdh,loopdl,endloopy,endloopx,endloopdh,endloopdl;
  471.   shl   bx, 1
  472.   shl   bx, 1
  473.   shl   bx, 1
  474.   shl   bx, 1
  475.   xor   eax, eax
  476.   xor   dx, dx
  477.   xor   bp,bp
  478.   loopdh:
  479.     loopdl:       mov       al, byte ptr fs:[textes+bx]
  480.           mov       si, word ptr fs:[mul420+eax*2]
  481.           FOR       YY, <0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20>
  482.             mov       di, fs:[mul320+YY*2]
  483.             add       di, bp
  484.             mov       cx,5
  485.             rep movsd
  486.           ENDM
  487.           inc       bx
  488.           add       bp, 20
  489.           inc       dl
  490.           cmp       dl, 16
  491.     endloopdl:    jne       loopdl
  492.           xor       dl, dl
  493.           add       bp, 6400
  494.           inc       dh
  495.           cmp       dh, 9
  496.   endloopdh:      jne       loopdh
  497. ENDM
  498.  
  499. CreateImg MACRO
  500. local debut,fin
  501.     xor     bx, bx
  502. debut:  inc     bx
  503.     mov     si, fs:[ebx*2]
  504.     add     si, bp
  505.     mov     ds, dx
  506.     mov     al, byte ptr ds:[si]
  507.     mov     ds, cx
  508.     add     al, ds:[bx]
  509. @@:     mov     di, gs:[ebx*2]
  510.     stosb
  511.     cmp     bx, 17860
  512. fin:    jne debut
  513. ENDM
  514.  
  515. PutBufToScr MACRO
  516.       mov        ax, 0102h               ; plan 0
  517.       mov        dx, 03C4h
  518.       out        dx, ax
  519.       add        di, 8000
  520.       mov        cx, 2000 ;3040
  521.       cld
  522.       rep        movsd
  523.  
  524.       mov        si, 16000
  525.       mov        ax, 0202h               ; plan 1
  526.       mov        dx, 03C4h
  527.       out        dx, ax
  528.  
  529.       sub        di, 8000 ;12160
  530.       mov        cx, 2000 ;3040
  531.       rep        movsd
  532.  
  533.       mov        ax, 0402h               ; plan 2
  534.       mov        dx, 03C4h
  535.       out        dx, ax
  536.  
  537.       mov        si, 32000
  538.       sub        di, 8000 ;12160
  539.       mov        cx, 2000 ;3040
  540.       rep        movsd
  541.  
  542.       mov        ax, 0802h               ; plan 3
  543.       mov        dx, 03C4h
  544.       out        dx, ax
  545.  
  546.       mov        si, 48000
  547.       sub        di, 8000 ;12160
  548.       mov        cx, 2000 ;3040
  549.       rep        movsd
  550. ENDM
  551.  
  552. CLRBUF MACRO
  553.     mov       ax, buf2
  554.     mov       es, ax
  555.     xor       di ,di
  556.  
  557.     mov       eax , 00h
  558.     mov       cx, 16000
  559.     rep       stosd
  560. ENDM
  561.  
  562. SUPER_FX PROC NEAR
  563.  
  564.       push    ds    
  565.  
  566.            add        bx, curstep
  567.  
  568.         mov        ax, buf2
  569.         mov        es, ax
  570.  
  571.         mov        dx, buf
  572.         mov        cx, shade
  573.  
  574.  
  575.         push       bx
  576.         push       fs
  577.         mov        bp, word ptr ds:[mul320+ebx*2]
  578.         mov        ax, source
  579.         mov        fs, ax
  580.  
  581.         CreateImg
  582.  
  583.         pop       fs
  584.          pop       bx
  585.         pop       ds
  586.  
  587.         mov        ax, 0A000h
  588.         mov        es, ax
  589.  
  590.         push      ds
  591.         mov       di, baseadress
  592.         mov       ax, buf2
  593.         mov       ds, ax
  594.         xor       si, si
  595.  
  596.         PutbufToScr
  597.  
  598.  
  599.         pop       ds
  600.  
  601.             ret
  602. Super_fx ENDP
  603.  
  604. ;---------------------
  605. ; point d'entree ....
  606. ;---------------------
  607.  
  608. _StartStar PROC FAR
  609.     push    bp
  610.     mov     bp,sp
  611.  
  612.     pushad
  613.     push    ds
  614.     push    es
  615.     push    fs
  616.     push    gs
  617.  
  618.         mov     ax,STAR_DATA
  619.         mov     ds,ax
  620.  
  621.     mov     ax, DGROUP
  622.     mov     fs, ax
  623.  
  624.  
  625. ;------- recuperer parametres sur le stack !!!! --------
  626.  
  627.          mov     ax,WORD PTR ss:[bp+6]  ; debut pos
  628.          shl     eax,14
  629.          or      ax,WORD PTR ss:[bp+8]  ; debut row
  630.          or      ah,al
  631.          shr     eax,8
  632.          mov     DebSong,ax
  633.          mov     ax,WORD PTR ss:[bp+10] ; fin pos
  634.          shl     eax,14
  635.          or      ax,WORD PTR ss:[bp+12] ; fin row
  636.          or      ah,al
  637.          shr     eax,8
  638.          mov     FinSong,ax
  639.          xor     eax,eax
  640. ;-------------------------------------------------------
  641.  
  642.  
  643.     ;mov     bx,WORD PTR fs:[_StartAdr]
  644.     ;mov     WORD PTR fs:[bx],Screen1     ; _StartAdr->base = 0
  645.     ;mov     bx,WORD PTR fs:[_WorkAdr]
  646.     ;mov     WORD PTR fs:[bx],Screen2     ; _WorkAdr->base
  647.     ;mov     WORD PTR fs:[bx+2],0         ; _WorkAdr->flag=false
  648.     ;mov     WORD PTR fs:[_Triple],0      ; double buffering
  649. ;        mov     word ptr fs:[_MichFlag],1
  650.  
  651.     mov     ax,STAR_DATA
  652.     mov     ds,ax
  653.  
  654.  
  655.     new     buf, 64000
  656.     new     buf2, 64000
  657.  
  658.     new     font1, 22260
  659.  
  660.     push    m320x200x256p
  661.     call    _SetVGA
  662.     add     sp,2
  663.  
  664.     load_fontpdfik
  665.     load_stretchpdfik
  666.     clrbuf
  667.  
  668.     load_pal pal
  669.  
  670. ;---- wait right position/row in tune ----
  671.  
  672.         pushad
  673.         MPUSH   ds,es,fs,gs
  674.  
  675.         ASSUME  ds:DGROUP
  676. ;        ASSUME  fs:STAR_DATA
  677.         mov     ax,DGROUP
  678.         mov     ds,ax
  679.         mov     ax,STAR_DATA   ; XCHG DS,FS !!!!
  680.         mov     fs,ax
  681.  
  682. ;;;;; attente bonne position music ;;;;; plante ???
  683. WaitPos:
  684.          mov     _ReplayInfo.numChannels,4 ; 4 voices
  685.  
  686.          les     bx,DWORD PTR [_MP]
  687.          push    ds
  688.          push    OFFSET _ReplayInfo
  689.  
  690.          ; _MP->GetInformation(&ReplayInfo)
  691.  
  692.          call    (ModulePlayer PTR es:[bx]).GetInformation
  693.          add     sp,4
  694.  
  695.          mov     ax,_ReplayInfo.pos
  696.          shl     eax,14
  697.          or      ax,_ReplayInfo.row
  698.          or      ah,al
  699.          shr     eax,8
  700.          cmp     ax,WORD PTR fs:[DebSong]  ; is it time ????
  701.          jb      WaitPos
  702.          xor     eax,eax
  703. ;;;;;;;;; plante ???????
  704.          ASSUME  ds:STAR_DATA
  705. ;         ASSUME  fs:DGROUP
  706.          MPOP    ds,es,fs,gs
  707.          popad
  708.          nop 
  709. ;------------------------------------------
  710.  
  711.  
  712.          mov     bx,fs:_StartAdr
  713.          mov     WORD PTR fs:[bx],Screen1   ; _StartAdr->base = 0
  714.          mov     WORD PTR fs:[bx+2],0       ; _StartAdr->flag = false
  715.          mov     bx,fs:_WorkAdr
  716.          mov     WORD PTR fs:[bx],Screen2   ; _WorkAdr->base
  717.          mov     WORD PTR fs:[bx+2],0       ; _WorkAdr->flag = false
  718.          mov     bx,fs:_NextAdr
  719.          mov     WORD PTR fs:[bx],Screen3   ; _NextAdr->base
  720.          mov     WORD PTR fs:[bx+2],0       ; _NextAdr->flag = false
  721.          mov     fs:_Triple,1               ; triple buffering
  722.  
  723.          WAITVRT
  724.  
  725.  
  726.           mov     word ptr fs:[_FrameCounter],0 ; set counter to NULL
  727.       mov        ax, dest
  728.       mov        gs, ax
  729.           mov        bx,21
  730.  
  731. ;=================== 1 ere boucle !!!!! ======================
  732.  
  733. loopvar:  inc       var
  734.       push      fs
  735.       push      ds
  736.       push    bx
  737.       mov       bx, var
  738.       mov       ax, ds
  739.       mov       fs, ax
  740.       mov       ax, buf
  741.       mov       es, ax
  742.       mov       ax, font1
  743.       mov       ds, ax
  744.       copy_font
  745.       pop        bx
  746.       pop        ds
  747.       pop        fs
  748. ;      push       ds
  749.  
  750.           sub        bx,21
  751. ;          xor   bx,bx
  752.  
  753. ;============== MAIN LOOP ==============
  754.  
  755. loopbx:
  756.  
  757. ;***** 2nd page *****
  758. Do_a_frame:
  759.         mov             di,fs:_WorkAdr
  760.         cmp             WORD PTR fs:[di+2],1 ; _WorkAdr->flag true (previous _NextAdr) ?
  761.         je              NextFrame        ; then construct next frame
  762.  
  763.         mov             Desti,di               ; save pointer
  764.  
  765.         mov             si,Desti
  766.         mov             ax,WORD PTR fs:[si]
  767.         mov             baseadress,ax         ; offset
  768.  
  769.         NEXTSTEP                                ; calculate nextstep :-)
  770.  
  771.         SHOWTIME        32
  772.  
  773.             call Super_FX
  774.  
  775.         SHOWTIME        0
  776.  
  777.         mov    di,fs:_NextAdr         ; save adr of next buffer
  778.  
  779.         mov    si,Desti
  780.         mov    WORD PTR fs:[si+2],1    ; _WorkAdr->flag = true
  781.  
  782.         cmp    bx,21
  783.         jae    loop2
  784.  
  785.         jmp  Nexxxt
  786.  
  787.  
  788. ;******** 3rd page *********
  789. NextFrame:
  790.          mov  di,fs:_NextAdr
  791.          cmp  WORD PTR fs:[di+2],1 ; _NextAdr true ?
  792.          je   NextFrame
  793.     
  794. Nexxxt:
  795.  
  796.         mov  Desti,di               ; save pointer
  797.  
  798.         mov             si,Desti
  799.         mov             ax,WORD PTR fs:[si]
  800.         mov             baseadress,ax         ; OFFSET in video mem
  801.  
  802.         NEXTSTEP                                ; calculate nextstep :-)
  803.  
  804.         SHOWTIME        32
  805.  
  806.             call Super_FX
  807.  
  808.         SHOWTIME        0
  809.  
  810.         mov             si,Desti
  811.         mov             WORD PTR fs:[si+2],1     ; _NextAdr->flag = true
  812.  
  813.         cmp  bx,21
  814.         jae  loop2
  815.  
  816.         LOOPUNTILKEY loopbx                      ; exit if keypressed
  817.  
  818. loop2:
  819.  
  820.         cmp   var, 358
  821.     jne   loopvar
  822.  
  823.  
  824. fin:
  825.         mov     fs:_FadeON,0             ; to be sure ....
  826.         FLUSH_KEYBUF
  827.  
  828.  
  829. ;        mov     word ptr fs:[_MichFlag],0
  830.  
  831.     free font1
  832.     free buf
  833.     free buf2
  834.     free source
  835.     free dest
  836.     free shade
  837.  
  838. ;------------------------------------------------------------------------------
  839. ; Libération des zones mémoires
  840.  
  841. error:
  842.        ; writeln " ■ Only for the WIRED'94 !!!"
  843. ;       Reset_Cursor
  844.  
  845.         mov     ax,0a000h           ; Clear screen
  846.         mov     es,ax
  847.         mov     dx,3c4h
  848.         mov     ax,0f02h
  849.         out     dx,ax
  850.         xor     eax,eax
  851.         xor     di,di
  852.         mov     cx,65536/4
  853.         rep     stosd
  854.  
  855.  
  856.     pop          gs
  857.     pop          fs
  858.     pop          es
  859.     pop          ds
  860.  
  861.     popad
  862.     nop
  863.  
  864.     leave
  865.     retf
  866.  
  867. _StartStar ENDP
  868.  
  869. STAR_TEXT ENDS
  870.  
  871.  
  872.     END
  873.